package com.next.aappublicapp.tasks;

import java.util.Date;

import android.os.AsyncTask;

import com.next.aappublicapp.util.TrackerUtl;

public abstract class FacebookAsyncTask<Params,Progress,Result> extends AsyncTask<Params, Progress, Result> {
	private String name;
	private String label;
	private Date startTime;
	public FacebookAsyncTask(String name,String label){
		this.name = name;
		this.label = label;
	}
	
	@Override
	protected final void onPreExecute() {
		startTime = new Date();
		this.beforeExecute();
	}
	protected void beforeExecute(){
		
	}
	
	@Override
	protected final void onPostExecute(Result result) {
		Date endTime = new Date();
		TrackerUtl.sendFacebookServerTiming(startTime.getTime() - endTime.getTime(), name, label);
		this.afterExecute(result);
	}
	protected void afterExecute(Result result){
		
	}

}
